package reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Test {
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {

        Class cls =Class.forName("reflect.Student");

        Constructor constructor = cls.getConstructor();
        Object obj = constructor.newInstance();
        System.out.println(obj);

        Object obj2 = cls.newInstance();
        System.out.println(obj2);

        Constructor constructor1 = cls.getConstructor(String.class,int.class,char.class);
        Object obj1 = constructor1.newInstance("张三",22,'A');
        System.out.println(obj1);
    }
}
